<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // const reg = /\d{3}/
        // const reg = /\d{3}/g        //全局匹配
        // const str = "abc123edf456xyz789"
        // console.log(str.match(reg));


        // const reg = /\d/
        // const str = "abc123edf456xyz789"
        // console.log(str.search(reg));
        
        
        // const reg = /\d/
        const reg = /\d/g
        const str = "abc123edf456xyz789"
        console.log(str.replace(reg,"**"));
    </script>
</body>
</html>